package us.icitap.commandcenter.utils;

import java.util.Calendar;
import java.util.Date;

import us.icitap.commandcenter.CommandCenterUI;
import us.icitap.commandcenter.business.ejb.dao.Expression;
import us.icitap.commandcenter.business.ejb.dao.Operator;

public class Utils {

	public static Date[] ShiftLimits(){
		
		Calendar c = Calendar.getInstance();
		
		Date startShift, endShift;
		
		if(c.get(Calendar.HOUR_OF_DAY) < 8){
			
			c.set(Calendar.HOUR_OF_DAY, 0);
			c.set(Calendar.MINUTE, 0);
			c.set(Calendar.SECOND, 0);
			
			startShift = c.getTime();
			
			
			c.set(Calendar.HOUR_OF_DAY, 8);
			endShift = c.getTime();
				
		}
		else if(c.get(Calendar.HOUR_OF_DAY) < 16){
			
			c.set(Calendar.HOUR_OF_DAY, 8);
			c.set(Calendar.MINUTE, 0);
			c.set(Calendar.SECOND, 0);
			startShift = c.getTime();
			
			c.set(Calendar.HOUR_OF_DAY, 16);
			endShift = c.getTime();
			
		}
		else{
			c.set(Calendar.HOUR_OF_DAY, 16);
			c.set(Calendar.MINUTE, 0);
			c.set(Calendar.SECOND, 0);
			startShift = c.getTime();
			
			
			c.set(Calendar.HOUR_OF_DAY, 23);
			c.set(Calendar.MINUTE, 59);
			c.set(Calendar.SECOND, 59);
			endShift = c.getTime();
		}
		
		return new Date[]{startShift,endShift};
	
	}
}
